package org.amicofragile.simpledsl;

import org.amicofragile.simpledsl.Optimizer1;

import groovy.util.GroovyTestCase;

class Optimizer2Test extends GroovyTestCase {
	public void testFoo() {
		def processedList = Optimizer2.withCriteria({it % 2 == 0 ? 'even' : 'odd'}).
			odd({it.inject(1) { acc, val -> acc * val}}).
			even({it.sort()}).
			process ([1, 3, 6, 4, 10, 2, 5, 3])

		assertArrayEquals([3, 2, 4, 6, 10, 15].toArray(), processedList.toArray())
	}
}
